﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ColdStorage;

namespace ColdStorage.DOL
{
    class Product
    {
        
         private double dbproductImportTemp; // nhiet do sp nhap vao
         private double dbproductImportUnevenCoefficient;// he so nhap hang ko dong deu
         private double dbproductRotationCoefficient;// he so quay vong hang
         private double dbproductStorageTemp;// nhiet do trong kho
         private double dbproductVolumeDailyImport;// khoi luong hang nhap vao tren ngay dem
         private double dbinputVolume;// khoi luong bao bi
         private int iwrappingType;// loai bao bi
         private double dbenthalpyBefore;
         private double dbenthalpyAfter;
         private double dbwrappingThermalCapacity;// nhiet dung rieng cua bao bi
         private int iheatFlowProduct;// dong nhiet toa ra khi san pham co nhiet do nhap vao
         private int iheatFlowProductInRoom;// dong nhiet toa ra voi nhiet do bao quan trong kho


        public double dbProductImportTemp
        {
            get { return dbproductImportTemp; }
            set { dbproductImportTemp = value; }
        }
        
        public double dbProductImportUnevenCoefficient
        {
            get { return dbproductImportUnevenCoefficient; }
            set { dbproductImportUnevenCoefficient = value; }
        }
        
        public double dbProductRotationCoefficient
        {
            get { return dbproductRotationCoefficient; }
            set { dbproductRotationCoefficient = value; }
        }
        
        public double dbProductStorageTemp
        {
            get { return dbproductStorageTemp; }
            set { dbproductStorageTemp = value; }
        }
        
        public double dbProductVolumeDailyImport
        {
            get { return dbproductVolumeDailyImport; }
            set { dbproductVolumeDailyImport = value; }
        }
        
        public double dbInputVolume
        {
            get { return dbinputVolume; }
            set { dbinputVolume = value; }
        }
        
        public int iWrappingType
        {
            get { return iwrappingType; }
            set { iwrappingType = value; }
        }
       
        public double dbEnthalpyBefore
        {
            get { return dbenthalpyBefore; }
            set { dbenthalpyBefore = value; }
        }
        
        public double dbEnthalpyAfter
        {
            get { return dbenthalpyAfter; }
            set { dbenthalpyAfter = value; }
        }

        public double dbWrappingThermalCapacity
        {
            get { return dbwrappingThermalCapacity; }
            set { dbwrappingThermalCapacity = value; }
        }
        
        public int iHeatFlowProduct
        {
            get { return iheatFlowProduct; }
            set { iheatFlowProduct = value; }
        }
        
        public int iHeatFlowProductInRoom
        {
            get { return iheatFlowProductInRoom; }
            set { iheatFlowProductInRoom = value; }
        }
        // Tính dòng nhiệt do sản phẩm tỏa ra
        public double CalculateProductHeat(double dbRoomCapacity)
        {
           return ((dbRoomCapacity*dbproductRotationCoefficient*dbProductImportUnevenCoefficient)/365)*(dbenthalpyBefore - dbenthalpyAfter)*((1000/(24*3600)));
        }
        // Tính dòng nhiệt do bao bì tỏa ra
        public double Calculatewrappingheat()
        {
            
            return dbInputVolume * dbwrappingThermalCapacity * (ColdStorage.dbcoldStorageOutsideTemp - dbproductStorageTemp) * ((1000 / (24 * 3600)));
        }

        //Tính khối lượng bao bì đưa vào
        public double CalculateWrappingVolume(double weight_rate)
        {
            return dbproductVolumeDailyImport * (weight_rate / 100);
        }
        // Tính dòng nhiệt do sản phẩm hô hấp
        public double CalculateProductRespiratory(int a)
        {
            return a * (0.1 * iheatFlowProduct + 0.9 * iheatFlowProductInRoom);

        }
       
     //  public double calculateproductheattotal()
     //  {
       //   double dbresult = calculateproductheat(3) + calculatewrappingheat(2,3)+ calculateproductrespiratory(200);
       //   return dbresult;
      // }
    }
    
}
